package com.tensuqare.user.dao;

import com.tensuqare.user.pojo.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

public interface UserDao extends JpaRepository<User,String>,JpaSpecificationExecutor<User> {

    //根据手机号查询出对应的user
    public User findByMobile(String mobile);
    //新增关注数
    @Query(nativeQuery = true,value = "update tb_user set followcount=followcount+?2 where id=?1")
    @Modifying
    public void addfollow(String userid,int x);

    //增加粉丝数
    @Query(nativeQuery = true,value = "update tb_user set fanscount=fanscount+?2 where id=?1")
    @Modifying
    public void addfans(String userid,int x);
}
